<?php
use yii\helpers\Html;
use yii\helpers\Url;
/* @var $this yii\web\View */
$this->title = '投资详情';
?>
<section id="body_h" class='bcolor-eb'>
		<br>
		<div class="modular4">
			<img width="100%" src="<?= Yii::getAlias('@web') . '/' ?>images/sele-top.jpg" alt="我的账户">
			<div class="modular4-con">
				<p class="modular4-con1">总待收(元)</p>
				<p class="modular4-con2"><?= number_format($userinfos['uncollected'],2);?></p>
				<table class="modular4-con3">
					<tr>
						<td>待收本金（元）</td>
						<td>待收利息（元）</td>
					</tr>
					<tr>
						<td><span><?= number_format($userinfos['capital'],2);?></span></td>
						<td><span><?= number_format($userinfos['interest'],2);?></span></td>
					</tr>
				</table>
				<p class="modular4-con4">最近一笔待收款项时间：<?= substr($userinfos['time'], 0,10);?></p>
			</div>
		</div>
	<div class="wh-container">
		<div class="modular5">
			<ul class="modular5-tit clearfix">
				<li data-cato="mould-5list1" data-url="uncollected/bidlist" class='current'><a href="/">竞标中</a></li>
				<li data-cato="mould-5list2" data-url="uncollected/auditlist"><a href="">待审核</a></li>
				<li data-cato="mould-5list3" data-url="uncollected/repaylist"><a href="/">还款中</a></li>
				<li data-cato="mould-5list4" data-url="uncollected/finishlist"><a href="/">已完成</a></li>
			</ul>
			<!--以下为循环的选项卡得内容部分-->
			<div id="mould-5list1" class="modular5-con hide">
				<table class="tablelist">
					<tr class="modular5-conttit">
						<td class="modular5-con1h">标名</td>
						<td class="modular5-con1h">投资金额</td>
						<td class="modular5-con1h">年利率</td>
						<td class="modular5-con1h">奖励利率</td>
						<td class="modular5-con1h">进度</td>
					</tr>
				<?php if ($bidlist){foreach ($bidlist as $K1=>$V1){?>
					<tr>
						<td><p class="text-l modular5-contit"><?= $V1['name'];?></p></td>
						<td class="modular5-con1h">￥<?= number_format($V1['money']);?></td>
						<td class="modular5-con1h"><?= $V1['rate'];?>%</td>
						<td class="modular5-con1h"><?= $V1['reward'];?>%</td>
						<td class="modular5-con1h"><?= $V1['progress'];?>%</td>
					</tr>
				<?php }}?>
					
				</table>
			</div>
			<div id="mould-5list2" class="modular5-con hide">
				<table class="tablelist">
					
				</table>
			</div>
			<div id="mould-5list3" class="modular5-con hide">
				<table class="tablelist">
					
				</table>
			</div>		
			<div id="mould-5list4" class="modular5-con hide">
				<table class="tablelist">
				
				</table>
			</div>		
		</div>
	  </div>
		<div class="footer-h"></div>
	</section>
	<section id="footer">
		<ul class="footer-nav clearfix">
		    <li class="current-bot">
		        <a href="<?= Url::to('main');?>">
		            <img src="<?= Yii::getAlias('@web') . '/' ?>images/footer1-on.png" alt="">
		            首页
		        </a>
		    </li>
		    <li>
		        <a href="<?= Url::to('member');?>">
		            <img src="<?= Yii::getAlias('@web') . '/' ?>images/footer2.png" alt="">
		            我的账户
		        </a>
		    </li>
		    <li>
		        <a href="<?= Url::to(['company/about']);?>">
		            <img src="<?= Yii::getAlias('@web') . '/' ?>images/footer3.png" alt="">
		            关于我们
		        </a>
		    </li>
		</ul>
	</section>
<script src="<?= Yii::getAlias('@web') . '/' ?>js/reset.js"></script>
	<script>
	$(function($) {
	    var UA=window.navigator.userAgent;  //使用设备
	    var CLICK="click";
	    if(/ipad|iphone|android/.test(UA)){   //判断使用设备
	        CLICK="tap";
	    }
	    var id='mould-5list1';
		var url = 'uncollected/bidlist';
        var page=1;//当前页
        var ul_obj = $('#'+id+' .tablelist'); //数据加载的位置
	    var catoFram=$(".modular5-con");
	    var subNav=$(".modular5-tit li");
	    $("#mould-5list1").removeClass("hide");
	    subNav[0].className += " current" ;
	    subNav[CLICK](function(event){
            event.preventDefault();
	        var _this=$(this);
	        page = 1;
	        id=_this.data("cato"); 
	        var cur=$("#"+id);
			url = _this.data("url");
			ul_obj = $('#'+id+' .tablelist'); //数据加载的位置
	        subNav.removeClass("current");
	        _this.addClass("current");
	        catoFram.addClass("hide");
	        cur.scrollTop(0);        
	        cur.removeClass("hide");
	        $.ajax({
                type: 'GET',
                url: '../'+url+'?page='+page+'&num=7&sKey='+'<?= $sKey;?>',
                dataType: 'text',
                success: function(json){
					var dataObj=eval("("+json+")");
			        ul_obj.find("tr").remove();	//移除列表内容
			        if(url=='uncollected/bidlist')
			        {
						var temp = '<tr class="modular5-conttit"><td class="modular5-con1h">标名</td><td class="modular5-con1h">投资金额</td><td class="modular5-con1h">年利率</td><td class="modular5-con1h">奖励利率</td><td class="modular5-con1h">进度</td></tr>';
				    }
			        else if(url=='uncollected/auditlist')
			        {
						var temp = '<tr class="modular5-conttit"><td class="modular5-con1h">标名</td><td class="modular5-con1h">投资金额</td><td class="modular5-con1h">年利率</td><td class="modular5-con1h">奖励利率</td><td class="modular5-con1h">收益</td></tr>';
				    }
			        else if(url=='uncollected/repaylist')
			        {
						var temp = '<tr class="modular5-conttit"><td class="modular5-con1h">标名</td><td class="modular5-con1h">投资金额</td><td class="modular5-con1h">已获收益</td><td class="modular5-con1h">已还/总期数</td></tr>';
				    }
			        else if(url=='uncollected/finishlist')
			        {
						var temp = '<tr class="modular5-conttit"><td class="modular5-con1h">标名</td><td class="modular5-con1h">年利率</td><td class="modular5-con1h">期限</td><td class="modular5-con1h">本金回款</td><td class="modular5-con1h">利息回款</td></tr>';
				    }
			        ul_obj.append(temp);
			        if(url=='uncollected/bidlist')
			        {
			        	$.each(dataObj.list,function(i,val){
							ul_obj.append('<tr><td><p class="text-l modular5-contit">'+val.name+'</p></td><td class="modular5-con1h">￥'+fmoney(val.money)+'</td><td class="modular5-con1h">'+val.rate+'%</td><td class="modular5-con1h">'+val.reward+'%</td><td class="modular5-con1h">'+val.progress+'%</td></tr>');
						});
				    }
			        else if(url=='uncollected/auditlist')
			        {
			        	$.each(dataObj.list,function(i,val){
							ul_obj.append('<tr><td><p class="text-l modular5-contit">'+val.name+'</p></td><td class="modular5-con1h">￥'+fmoney(val.money)+'</td><td class="modular5-con1h">'+val.rate+'%</td><td class="modular5-con1h">'+val.reward+'%</td><td class="modular5-con1h">'+val.profit+'</td></tr>');
						});
				    }
			        else if(url=='uncollected/repaylist')
			        {
			        	$.each(dataObj.list,function(i,val){
							ul_obj.append('<tr><td><p class="text-l modular5-contit">'+val.name+'</p></td><td class="modular5-con1h">￥'+fmoney(val.money)+'</td><td class="modular5-con1h">'+val.profit+'</td><td class="modular5-con1h">'+val.current+'/'+val.duration+'5（'+val.time.substr(0,10)+'）</td></tr>');
						});
				    }
			        else if(url=='uncollected/finishlist')
			        {
			        	$.each(dataObj.list,function(i,val){
							ul_obj.append('<tr><td><p class="text-l modular5-contit">'+val.name+'</p></td><td class="modular5-con1h">'+val.interest+'%</td><td class="modular5-con1h">'+val.duration+'</td><td class="modular5-con1h">￥'+fmoney(val.money)+'</td><td class="modular5-con1h">￥'+fmoney(val.profit)+'</td></tr>');
						});
				    }
                    $(".loading").remove();//删除加载图片
                    ajax=!1;//注明已经完成ajax加载
                },
                error: function(xhr, type){
                    $(".loading").html("暂无内容！");
                }
            });
            $(".bodyA").hide();
	    });
	  //需要 zepto.js支持
        var ajax=!1;//是否加载中
        Zepto(function($){
            $(window).scroll(function(){
                if(($(window).scrollTop() + $(window).height() > $(document).height()-40) && !ajax){
                    //滚动条拉到离底40像素内，而且没ajax中，而且没超过总页数
					if(id=="mould-5list1")
			        {
			        	$(".bodyA").hide();
						return false;
				     }
                    page++;//当前页增加1
                    ajax=!0;//注明开始ajax加载中
                    $(".wh-container").append('<div class="loading" style="text-align:center;  font-size:16px; color:#999; "><img  style="vertical-align: middle; margin-right:10px;" src="<?= yii::getAlias('@web').'/' ?>images/loading1.gif" alt="" />上拉加载</div> ');//出现加载图片
					
                    $.ajax({
                        type: 'GET',
                        url: '../'+url+'?page='+page+'&num=7&sKey='+'<?= $sKey;?>',
                        dataType: 'text',
                        success: function(json){
							var dataObj=eval("("+json+")");
							if(dataObj.list)
							{
								if(url=='uncollected/bidlist')
						        {
						        	$.each(dataObj.list,function(i,val){
										ul_obj.append('<tr><td><p class="text-l modular5-contit">'+val.name+'</p></td><td class="modular5-con1h">￥'+fmoney(val.money)+'</td><td class="modular5-con1h">'+val.rate+'%</td><td class="modular5-con1h">'+val.reward+'%</td><td class="modular5-con1h">'+val.progress+'%</td></tr>');
									});
							    }
						        else if(url=='uncollected/auditlist')
						        {
						        	$.each(dataObj.list,function(i,val){
										ul_obj.append('<tr><td><p class="text-l modular5-contit">'+val.name+'</p></td><td class="modular5-con1h">￥'+fmoney(val.money)+'</td><td class="modular5-con1h">'+val.rate+'%</td><td class="modular5-con1h">'+val.reward+'%</td><td class="modular5-con1h">'+val.profit+'</td></tr>');
									});
							    }
						        else if(url=='uncollected/repaylist')
						        {
						        	$.each(dataObj.list,function(i,val){
										ul_obj.append('<tr><td><p class="text-l modular5-contit">'+val.name+'</p></td><td class="modular5-con1h">￥'+fmoney(val.money)+'</td><td class="modular5-con1h">'+val.profit+'</td><td class="modular5-con1h">'+val.current+'/'+val.duration+'5（'+val.time.substr(0,10)+'）</td></tr>');
									});
							    }
						        else if(url=='uncollected/finishlist')
						        {
						        	$.each(dataObj.list,function(i,val){
										ul_obj.append('<tr><td><p class="text-l modular5-contit">'+val.name+'</p></td><td class="modular5-con1h">'+val.interest+'%</td><td class="modular5-con1h">'+val.duration+'</td><td class="modular5-con1h">￥'+fmoney(val.money)+'</td><td class="modular5-con1h">￥'+fmoney(val.profit)+'</td></tr>');
									});
							    }
	                            
	                            $(".loading").remove();//删除加载图片
	                            ajax=!1;//注明已经完成ajax加载
							}
							else if(dataObj.msg=='sKey已失效！')
							{
								$(".loading").remove();//删除加载图片
								location.href='<?= Url::to(['site/signin']);?>';
							}
							else
							{
								$(".loading").html("暂无内容！");
	                            ajax=!0;
							}
                        },
                        error: function(xhr, type){
                            $(".loading").html("暂无内容！");
                            ajax=!0;
                        }
                    });
                }
            });
        });
		$(".bodyA").hide();
	});
	function fmoney(strNum) {
		if (strNum.length <= 3) {
		return strNum;
		}
		if (!/^(\+|-)?(\d+)(\.\d+)?$/.test(strNum)) {
		return strNum;
		}
		var a = RegExp.$1, b = RegExp.$2, c = RegExp.$3;
		var re = new RegExp();
		re.compile("(\\d)(\\d{3})(,|$)");
		while (re.test(b)) {
		b = b.replace(re, "$1,$2$3");
		}
		return a + "" + b + "" + c;
		}
</script>
<script src='<?= Yii::getAlias('@web') . '/' ?>js/zepto.min.js'></script>